<?php
namespace Home\Controller;
class TongController extends  PublicController
{
    
    
    public function index(){
    
    	$list=M('client')->select();
    	foreach($list as $key=>$val){
    		$inte=M('inte')->where(array('cid'=>$val['uid']))->select();
    		foreach($inte as $k=>$v){
    			$cid=$v['cid'];
    			$ss[$cid]['cid']=$val['uid'];
    			$ss[$cid]['uname']=$val['uname'];
    			$ss[$cid]['sheng']=$val['score'];
    			if(($v['biao'] == '1') || ($v['biao'] == '2') || ($v['biao'] == '3')){
    				$ss[$cid]['scorec'] +=$v['score'];
    			}elseif(($v['biao'] == '4') || ($v['biao'] == '5')){
    				$ss[$cid]['scorer'] +=$v['score'];
    			}
    		}
    	}

    	$this->assign('list',$ss);
    	$this->display();
    }
    
    
}


?>